﻿
#ifndef WEIGHTTASK_H
#define WEIGHTTASK_H
#define WT3190      1
#define XK3190_A9   2
#define TLD8142     3
#define HT9800      4
#define XK3196B     5
#define maxCount    30
#define baseValue   2.5
#include <QThread>
#include "time.h"
#include "unistd.h"
#include <QDebug>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <termios.h>
#include <QDebug>
#include <QObject>
#include "unitclass.h"
#include "systemfile.h"
class weightTask : public QThread
{
    Q_OBJECT
public:
    weightTask(int fd);
    bool IsOk;
    bool IsUp;
    bool IsOnceWeight;
    float weight_max;
    float weightValue; //称重稳值
    float weightComp;  //称重比较值
    int counter;       //稳定值计数器

    float DyWeightValue;//动态磅重量

    int dynamicAxis; //动态轮轴数

    void runThread();
    bool sendData(char *buffer);

    void dealData(char* buf);


    void getWeightValue(float weight);

    void getDyWeightValue(float weight);

    //不同磅表对应的不同的接口
    //l娄烦磅表D2008
    float D2008();

    //汾阳的磅表行号d2008
    float D2008_fy();
    //石家庄
    float DT();


    float XK3190A9();
    float HT9800B();
    float XK315A();
    float T8142PRO1();
    float XK3102S();
    float XK3110E();
    float QDI31();
    float M8142PRO();
    float D2002E1();
    float D2002ED();
    float T800();
    float XK3190D2();
    float D2002E();
    float XK3120C();//3-'XK3120C'//4-'XK3109'


    static char *strrev2(char *str);
protected:
    virtual void run();
private:
    int fd;             //串口句柄
             //
    
};

#endif // WEIGHTTASK_H
